﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="EmpolyeeList.aspx.cs" Inherits="Empolyee_EmpolyeeList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <h2>
        员工管理</h2>
    <div class="searchcondition">
        <table class="searchtb">
            <tr>
                <td>
                    角色
                </td>
                <td>
                    <asp:DropDownList ID="DropDownList2" runat="server" AppendDataBoundItems="True" 
                        DataSourceID="SqlDataSource3" DataTextField="RoleName" DataValueField="RoleID">
                        <asp:ListItem Value="999">所有角色</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                   分行 
                </td>
                <td>
                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2"
                        DataTextField="BranchName" DataValueField="BranchID" 
                        AppendDataBoundItems="True">
                        <asp:ListItem Value="999">所有分行</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
        <div>
            <asp:Button ID="Button2" runat="server" Text="查询" CssClass="searchbutton" 
                CausesValidation="True" onclick="Button2_Click" />
        </div>
    </div>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="EmpolyeeID"
        DataSourceID="SqlDataSource1" CssClass="commongv" OnRowDataBound="GridView1_RowDataBound"
        OnRowCommand="GridView1_RowCommand">
        <Columns>
            <asp:BoundField DataField="姓名" HeaderText="姓名" SortExpression="姓名" />
            <asp:BoundField DataField="登录帐号" HeaderText="登录帐号" SortExpression="登录帐号" />
            <asp:BoundField DataField="密码" HeaderText="密码" SortExpression="密码" />
            <asp:BoundField DataField="角色" HeaderText="角色" SortExpression="角色" />
            <asp:BoundField DataField="Status" HeaderText="状态" ReadOnly="True" SortExpression="Status" />
            <asp:BoundField DataField="Other" HeaderText="底薪" ReadOnly="True" SortExpression="Other" />
            <asp:BoundField DataField="令牌条形码" HeaderText="令牌条形码" ReadOnly="true" SortExpression="令牌条形码" />
            <%--<asp:HyperLinkField Text="管理" DataNavigateUrlFields="EmpolyeeID" DataNavigateUrlFormatString="~/Empolyee/EmpolyeeDetail.aspx?ID={0}" />--%>
            <asp:TemplateField>
                <HeaderTemplate>
                    操作</HeaderTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkManagement" runat="server" CausesValidation="False" CommandName="Management"
                        Visible="True" CommandArgument='<%#Eval("EmpolyeeID") %>' Text="管理"></asp:LinkButton>
                    <asp:LinkButton ID="linkCancel" runat="server" CausesValidation="False" CommandName="Cancel"
                        Visible="false" CommandArgument='<%#Eval("EmpolyeeID") %>' Text="作废" OnClientClick="return confirm('作废吗？');"></asp:LinkButton>
                    <asp:LinkButton ID="linkContracts" runat="server" CausesValidation="False" CommandName="Contracts"
                        Visible="False" CommandArgument='<%#Eval("EmpolyeeID") %>' Text="分配合同"></asp:LinkButton>
                        
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="info"
                        Visible="true" CommandArgument='<%#Eval("EmpolyeeID") %>' Text="查看"></asp:LinkButton>
                    <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="LoginCondition"
                        Visible="true" CommandArgument='<%#Eval("登录帐号") %>' Text="查看签到"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="EmpolyeeID" HeaderText="EmpolyeeID" ReadOnly="True" SortExpression="EmpolyeeID"
                Visible="false" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:KOONCRMDB %>"
        SelectCommand="Empolyee_GetEmpolyees" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" Name="branchid" 
                PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="DropDownList2" Name="roleid" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:KOONCRMDB %>"
        SelectCommand="SELECT * FROM [Branch]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:KOONCRMDB %>" 
        SelectCommand="SELECT * FROM [Role]"></asp:SqlDataSource>
</asp:Content>
